import Util from "../../utils/util";

const app = getApp()
Component({
  properties: {
    dialogTip: {
      type: Boolean,
      value: false,
    },
    dialogContent: Object,
    original: String,
    joinData: {
      type: Object,
      value: [],
    }
  },
  data: {},
  attached: function () {
  },
  methods: {

    cancel(e) {
      this.setData({
        dialogTip: false
      })

      if (!Util.isEmpty(this.data.dialogContent) && this.data.dialogContent.cancelLink) {
        wx.navigateTo({
          url: this.data.dialogContent.cancelLink
        })
      }

      //Todo 回调
      this.triggerEvent("cancel", this.data.dialogContent || null)
    },

    confirm(e) {
      const that = this

      if (!Util.isEmpty(this.data.dialogContent.confirmReturn)) {
        this.triggerEvent("confirm", this.data.dialogContent || null)
        this.setData({
          dialogTip: false
        })
        return
      }

      if (!Util.isEmpty(this.data.dialogContent) && this.data.dialogContent.confirmLink) {
        wx.navigateTo({
          url: this.data.dialogContent.confirmLink
        })
        return;
      }

    },

  }
});